package com.heima.wemedia.controller.v1;

import com.heima.common.dtos.PageResponseResult;
import com.heima.common.dtos.ResponseResult;
import com.heima.model.article.dtos.ArticleBehaviorDto;
import com.heima.model.behavior.dtos.ArticleBehaviorByTimeDto;
import com.heima.wemedia.service.WmStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 行为统计
 */
@RestController
@RequestMapping("/api/v1/statistics")
public class WmStatisticsController {
    @Autowired
    private WmStatisticsService wmStatisticsService;

    /**
     * 查询当前统计行为数量
     *
     * @return
     */
    @PostMapping("/newsDimension")
    public ResponseResult newsDimension(@RequestBody ArticleBehaviorByTimeDto dto) {
        ResponseResult responseResult = wmStatisticsService.newsDimension(dto);
        return responseResult;
    }

    /**
     * 查询文章列表
     */
    @PostMapping("/newsPage")
    public PageResponseResult newsPage(@RequestBody ArticleBehaviorDto dto) {
        return wmStatisticsService.newsPage(dto);
    }
}
